<?php
global $_GPC, $_W;
$GLOBALS['frames'] = $this->getMainMenu();
$pageindex = max(1, intval($_GPC['page']));
$pagesize=10;
$where=" where activity_id=:activity_id and user_id=:user_id and status=1";
$data[':activity_id']=$_GPC['activity_id'];
$data[':user_id']=$_GPC['user_id'];
$sql="SELECT * FROM ".tablename('zh_gjhdbm_bmlist') . $where." ORDER BY id DESC";
$total=pdo_fetchcolumn("SELECT count(*) FROM ".tablename('zh_gjhdbm_bmlist') . $where,$data);
$select_sql =$sql." LIMIT " .($pageindex - 1) * $pagesize.",".$pagesize;
$list=pdo_fetchall($select_sql,$data);
$pager = pagination($total, $pageindex, $pagesize);
if($_GPC['op']=='adopt'){
	$res=pdo_update('zh_gjhdbm_bmlist',array('state'=>2),array('id'=>$_GPC['id']));
	if($res){
		message('操作成功！', $this->createWebUrl('activity'), 'recommend');
	}else{
		message('操作失败！','','error');
	}

}
if($_GPC['op']=='reject'){
	$result=$this->wxrefund($_GPC['id']);
    if ($result['result_code'] == 'SUCCESS') {//退款成功
        //更改订单操作拒绝
        pdo_update('zh_gjhdbm_bmlist',array('state'=>6),array('id'=>$_GPC['id']));           
        message('拒绝成功',$this->createWebUrl('activity',array()),'success');
        }else{
         message($result['err_code_des'],'','error');
        }
}
if($_GPC['op']=='refund'){
	$result=$this->wxrefund($_GPC['id']);
    if ($result['result_code'] == 'SUCCESS') {//退款成功
        //更改订单操作拒绝
        pdo_update('zh_gjhdbm_bmlist',array('state'=>5),array('id'=>$_GPC['id']));           
        message('退票成功',$this->createWebUrl('activity',array()),'success');
        }else{
         message($result['err_code_des'],'','error');
        }
}
if($_GPC['op']=='tprejeck'){//拒绝退票
    $rst= pdo_update('zh_gjhdbm_bmlist',array('state'=>2),array('id'=>$_GPC['id']));   
    if($rst){        
        message('拒绝成功',$this->createWebUrl('activity',array()),'success');
        }else{
         message($result['err_code_des'],'','error');
        }
}
include $this->template('web/pjlist');